package com.leaves.leetcode.array.t1052_MaxSatisfied;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.leaves.leetcode.UnitTesting;

public class T1052Main extends UnitTesting<Object[], Integer> {

    Solution solution =  new Solution();

    @Override
    protected void generateTestData() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            testDataList.add(createTestData(
                    objectMapper.readValue("[[1,0,1,2,1,1,7,5], [0,1,0,1,0,1,0,1], 3]", new TypeReference<Object[]>() {}),
                    16
            ));
            testDataList.add(createTestData(
                    objectMapper.readValue("[[1], [0], 1]", new TypeReference<Object[]>() {}),
                    1
            ));
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Integer run(Object[] inputData) {
        int[] customers = (int[]) inputData[0];
        int[] grumpy = (int[]) inputData[1];
        int minutes = (int) inputData[2];
        return solution.maxSatisfied(customers, grumpy, minutes);
    }
}
